screen_to_client (hwnd, screen_pt, &client_pt);
hwndc = ChildWindowFromPointEx (hwnd, client_pt, CWP_SKIPDISABLED |
CWP_SKIPINVISIBLE);
+
+ /* Verify that we're really inside the client area of the window */
+ if (hwndc != hwnd)
+ {
+ GetClientRect (hwndc, &rect);
+ screen_to_client (hwndc, screen_pt, &client_pt);
+ if (!PtInRect (&rect, client_pt))
+ hwndc = hwnd;
+ }
+
} while (hwndc != hwnd && (hwnd = hwndc, 1));
}
{
hwnd = WindowFromPoint (screen_pt);
+ /* Verify that we're really inside the client area of the window */
+ GetClientRect (hwnd, &rect);
+ screen_to_client (hwnd, screen_pt, &client_pt);
+ if (!PtInRect (&rect, client_pt))
+ hwnd = NULL;
+
/* If we didn't hit any window at that point, return the desktop */
if (hwnd == NULL)
{
if (window && (win_x || win_y))
{
- screen_to_client (hwnd, screen_pt, &client_pt);
- GetClientRect (hwnd, &rect);
-
if (win_x)
- *win_x = client_pt.x - rect.left;
+ *win_x = client_pt.x;
if (win_y)
- *win_y = client_pt.y - rect.top;
+ *win_y = client_pt.y;
}
return window;